from selenium.webdriver.android import webdriver
from selenium.webdriver.support.wait import WebDriverWait


class Base:
    def __init__(self):
        self.driver=webdriver.Chrome()
        self.driver.maximize_window()
        self.driver.get("http://hmshop-test.itheima.nat/index.php/Home/user/login.html")
    def base_find(self,loc,timeout=30,poll=0.5):
        return WebDriverWait(self.driver,timeout,poll).until(lambda x:x.find_element(*loc))
    def base_input(self,loc,value):
        el=self.base_find(loc)
        el.clear()
        el.send_keys(value)
    def base_click(self,loc):
        self.base_find(loc).click()
    def base_get_text(self,loc):
        return self.base_find(loc).text